﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using AngryNerds;
using Microsoft.Xna.Framework;

namespace TestAngryNerds
{
    [TestClass]
    public class TestPhysicsEngine
    {
        [TestMethod]
        public void TestCalculateAngleInRadian()
        {
            Assert.AreEqual<float>(MathHelper.Pi/2,PhysicsEngine.CalculateAngleInRadian(new Vector2(10,50),new Vector2(10,80)));
            Assert.AreEqual<float>(0f,PhysicsEngine.CalculateAngleInRadian(new Vector2(85,100),new Vector2(49,100))%MathHelper.Pi);
        }

        [TestMethod]
        public void TestCalculateVelocity()
        {
            float angle = MathHelper.Pi / 7;
            Assert.AreEqual<decimal>(Math.Floor((decimal)22.439f),Math.Floor((decimal)PhysicsEngine._CalculateVelocity(angle)));
        }

        [TestMethod]
        public void TestCalculateCurrentPoint()
        {
            float velocity = 20f,angle=MathHelper.Pi/3,time=1.2f;
            Vector2 point = new Vector2(20,100);
            Assert.AreEqual<Vector2>(new Vector2(32f,86.41539f),PhysicsEngine.CalculateCurrentPoint(point,velocity,angle,time));
        }
    }
}